package cn.hznc.domain.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;
import java.util.Objects;

/**
 * @Author：Administrator
 * @Date：2023/8/3 14:08
 */
@Getter
@Setter
@Table(name = "t_abutment_entry_exit_record")
@TableName(value = "t_abutment_entry_exit_record")
public class AbutmentEntryExitRecordEntity{

    /**
     * 主键id
     */
    @Column(name = "id",type = MySqlTypeConstant.INT,length = 11,isKey = true,isAutoIncrement = true)
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 单据编号
     */
    @Column(name = "document_number",type = MySqlTypeConstant.VARCHAR,length = 100)
    @TableField(value = "document_number")
    private String documentNumber;

    /**
     * 物料编码
     */
    @Column(name = "partno",type = MySqlTypeConstant.VARCHAR,length = 100)
    @TableField(value = "partno")
    private String partno;

    /**
     * 物料型号
     */
    @Column(name = "part_type",type = MySqlTypeConstant.VARCHAR,length = 100)
    @TableField(value = "part_type")
    private String partType;

    /**
     * 物料名称
     */
    @Column(name = "material_name",type = MySqlTypeConstant.VARCHAR,length = 100)
    @TableField(value = "material_name")
    private String materialName;

    /**
     * 事务数量（出入库数量）
     */
    @Column(name = "number",type = MySqlTypeConstant.INT,length = 5)
    @TableField(value = "number")
    private Integer number;

    /**
     * 事务类型（1.入库 2.出库）
     */
    @Column(name = "type",type = MySqlTypeConstant.TINYINT)
    @TableField(value = "type")
    private Integer type;

    /**
     * 使用机床
     */
    @Column(name = "equipment",type = MySqlTypeConstant.VARCHAR,length = 100)
    @TableField(value = "equipment")
    private String equipment;

    /**
     * 确认人
     */
    @Column(name = "operator",type = MySqlTypeConstant.VARCHAR,length = 100)
    @TableField(value = "operator")
    private String operator;

    /**
     * 金额
     */
    @Column(name = "amount",type = MySqlTypeConstant.VARCHAR,length = 100)
    @TableField(value = "amount")
    private Double amount;

    /**
     * 使用订单
     */
    @Column(name = "task_id",type = MySqlTypeConstant.VARCHAR,length = 100)
    @TableField(value = "task_id")
    private String taskId;

    /**
     * 成本中心
     */
    @Column(name = "cost_center",type = MySqlTypeConstant.VARCHAR,length = 100)
    @TableField(value = "cost_center")
    private String costCenter;

    /**
     * 成本中心名称
     */
    @Column(name = "cost_center_name",type = MySqlTypeConstant.VARCHAR,length = 100)
    @TableField(value = "cost_center_name")
    private String costCenterName;

    /**
     * 备注
     */
    @Column(name = "bz",type = MySqlTypeConstant.VARCHAR,length = 100)
    @TableField(value = "bz")
    private String bz;

    /**
     * 操作工号
     */
    @Column(name = "employee_no",type = MySqlTypeConstant.VARCHAR,length = 100)
    @TableField(value = "employee_no")
    private String employeeNo;


    /**
     * 使用工号
     */
    @Column(name = "use_employee_no",type = MySqlTypeConstant.VARCHAR,length = 100)
    @TableField(value = "use_employee_no")
    private String useEmployeeNo;

    /**
     * 操作日期
     */
    @Column(name = "operate_time",type = MySqlTypeConstant.DATETIME)
    @TableField(value = "operate_time")
    @JSONField(format = "yyyy-MM-dd")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private Date operateTime;

    /**
     * 制单日期
     */
    @Column(name = "create_time",type = MySqlTypeConstant.DATETIME)
    @TableField(value = "create_time")
    @JSONField(format = "yyyy-MM-dd")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private Date createTime;

    /**
     * 制单人
     */
    @Column(name = "creator",type = MySqlTypeConstant.VARCHAR,length = 100)
    @TableField(value = "creator")
    private String creator;


    /**
     * 单据序号
     */
    @Column(name = "document_no",type = MySqlTypeConstant.VARCHAR,length = 100)
    @TableField(value = "document_no")
    private String documentNo;

    /**
     * 存放库位
     */
    @Column(name = "storage_location",type = MySqlTypeConstant.VARCHAR,length = 100)
    @TableField(value = "storage_location")
    private String storageLocation;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        AbutmentEntryExitRecordEntity that = (AbutmentEntryExitRecordEntity) o;

        if (!Objects.equals(documentNumber, that.documentNumber))
            return false;
        return Objects.equals(documentNo, that.documentNo);
    }

    @Override
    public int hashCode() {
        int result = documentNumber != null ? documentNumber.hashCode() : 0;
        result = 31 * result + (documentNo != null ? documentNo.hashCode() : 0);
        return result;
    }
}
